home *** CD-ROM | disk | FTP | other *** search
- Path: free1-slip207.tele.queensu.ca!user
- From: 3gl21@qlink.queensu.ca (Gregory Lo)
- Newsgroups: comp.lang.c++
- Subject: Re: Why Do Return Values Sometimes Have '&' Appended?
- Date: Wed, 21 Feb 1996 20:48:55 -0608
- Organization: Queen's University
- Distribution: world
- Message-ID: <3gl21-2102962048550001@free1-slip207.tele.queensu.ca>
- References: <4ggciv$iq1@alcor.usc.edu>
- Reply-To: 3gl21@qlink.queensua.c
- NNTP-Posting-Host: free1-slip207.tele.queensu.ca
- X-Newsreader: Yet Another NewsWatcher 2.2.0b4
-
- In article <4ggciv$iq1@alcor.usc.edu>, wawda@alcor.usc.edu (Abu Wawda) wrote:
-
- > I have seen code where some of the functions are returned with the
- > reference operator (&) attached to the end. Here is an example:
- [snip]
- > I understand why you the function parameter uses the & operator since
- > you want to pass the class by reference, but why is it used in the
- > return value? Thank you,
-
- Simply enough, you want to return a *reference* to an object rather than a
- new object constructed on the stack.
-
- Greg Lo
-